<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=9,IE=edge,chrome=1" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta name="renderer" content="webkit">
    <meta charset="UTF-8">
    <title>众筹用户详情</title>
    <style>body{background: #EFEFF4}</style>
</head>
<body>
<div class="mui-scroll-wrapper" id="scrollWrapper">
    <div class="mui-scroll">
        <div class="active-list-wrap" data-MH="true" id="activeListWrap"></div>
    </div>
</div>
<script type="text/html" id="tplActiveList">
    <table class="list">
        {{each list as value i}}
        <tr>
            <td>{{i+1}}</td>
            <td><img src="{{value.head_url}}" style="width: 40px;border-radius: 5rem;"></td>
            <td>{{value.name}}</td>
            <td>参与众筹</td>
            <td>{{formatTime(value.create_time, 'YYYY/MM/DD HH:ii', false)}}</td>
        </tr>
        {{/each}}
    </table>
</script>
<script type="text/javascript">
    var _textIndex = 0, total_page = 0;

    //上拉加载数据
    function pullUp2Refresh() {
        var _list = $('#activeListWrap'), _this = this;
        //如果存在数据，则继续添加数据
        $.ajax({
            url: _basePath + "/app/act/fundUsers",
            data: {
                id: ${id},
                curPage: _textIndex + 1
            },
            dataType: 'json',
            success: function (data) {
                total_page = data['resultList']['totalPage'];
                var _html = template('tplActiveList', data.resultList);
                _list.append(_html);

                _textIndex++;

                //如果存在数据，则继续添加数据
                if (_textIndex < total_page) {
                    _this.endPullupToRefresh(false);
                } else {
                    _this.endPullupToRefresh(true);
                }
            }
        });
    }

    $(function(){

        //初始化上拉加载
        mui.init({
            pullRefresh : {
                container:'div#scrollWrapper',//待刷新区域标识，querySelector能定位的css选择器均可，比如：id、.class等
                up : {
                    height:50,//可选.默认50.触发上拉加载拖动距离
                    auto:true,//可选,默认false.自动上拉加载一次
                    contentrefresh : "正在加载...",//可选，正在加载状态时，上拉加载控件上显示的标题内容
                    contentnomore:'我是有底线的',//可选，请求完毕若没有更多数据时显示的提醒内容；
                    callback : pullUp2Refresh //必选，刷新函数，根据具体业务来编写，比如通过ajax从服务器获取新数据；
                }
            }
        });
    });
</script>
